FLAGS = -pthread -I src/framework/osx/ -I src/framework/common/ -I src/standard/2.uge/ -I src/standard/3.uge/
VPATH = src/framework/common/:src/framework/osx/:src/standard/1.uge/:src/standard/2.uge/:src/standard/3.uge/
all: uge3	

framework: SocketStream.o SocketAcceptor.o SocketConnector.o InetAddress.o SelectorReactor.o DemuxTable.o MyReactor.o Connector.o Acceptor.o Buffer.o Thread.o

SocketStream.o: SocketStream.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

SocketAcceptor.o: SocketAcceptor.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

SocketConnector.o: SocketConnector.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

InetAddress.o: InetAddress.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

SelectorReactor.o: SelectorReactor.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

DemuxTable.o: DemuxTable.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

MyReactor.o: MyReactor.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

Connector.o: Connector.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

Acceptor.o: Acceptor.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

Buffer.o: Buffer.cpp
	g++ $(FLAGS) -c -o bin/$@ $<

Thread.o: Thread.cpp
	g++ $(FLAGS) -c -o bin/$@ $<

uge1: framework uge1_client uge1_server

uge1_client: Client.cpp
	g++ $(FLAGS) -o bin/$@ $< bin/SocketStream.o bin/SocketAcceptor.o bin/SocketConnector.o bin/InetAddress.o bin/SelectorReactor.o bin/DemuxTable.o bin/MyReactor.o

uge1_server: Server.cpp
	g++ $(FLAGS) -o bin/$@ $< bin/SocketStream.o bin/SocketAcceptor.o bin/SocketConnector.o bin/InetAddress.o bin/SelectorReactor.o bin/DemuxTable.o bin/MyReactor.o

uge2: framework uge2_parts uge2_server uge2_client

uge2_parts: AlarmAcceptor.o AlarmHandler.o LogAcceptor.o LogHandler.o PatientAcceptor.o PatientHandler.o

AlarmAcceptor.o: AlarmAcceptor.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

AlarmHandler.o: AlarmHandler.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

LogAcceptor.o: LogAcceptor.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

LogHandler.o: LogHandler.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

PatientAcceptor.o: PatientAcceptor.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

PatientHandler.o: PatientHandler.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

uge2_server: ReactorServer.cpp
	g++ $(FLAGS) -o bin/$@ $< bin/SocketStream.o bin/SocketAcceptor.o bin/SocketConnector.o bin/InetAddress.o bin/SelectorReactor.o bin/DemuxTable.o bin/MyReactor.o  bin/AlarmAcceptor.o bin/AlarmHandler.o bin/LogAcceptor.o bin/LogHandler.o bin/PatientAcceptor.o bin/PatientHandler.o

uge2_client: ManuelClient.cpp
	g++ $(FLAGS) -o bin/$@ $< bin/SocketStream.o bin/SocketAcceptor.o bin/SocketConnector.o bin/InetAddress.o bin/SelectorReactor.o bin/DemuxTable.o bin/MyReactor.o  bin/AlarmAcceptor.o bin/AlarmHandler.o bin/LogAcceptor.o bin/LogHandler.o bin/PatientAcceptor.o bin/PatientHandler.o

uge3: framework uge3_parts uge3_server uge3_client

uge3_parts: EchoServiceHandler.o RecvServiceHandler.o PatientService.o

PatientService.o: PatientService.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

EchoServiceHandler.o: EchoServiceHandler.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

RecvServiceHandler.o: RecvServiceHandler.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

PatientServiceHandler.o: PatientServiceHandler.cpp
	g++ $(FLAGS) -c -o bin/$@ $< 

uge3_server:  PatientServer.cpp
	g++ $(FLAGS) -o bin/$@ $< bin/SocketStream.o bin/SocketAcceptor.o bin/SocketConnector.o bin/InetAddress.o bin/SelectorReactor.o bin/DemuxTable.o bin/MyReactor.o bin/Connector.o bin/Acceptor.o bin/EchoServiceHandler.o bin/Buffer.o bin/PatientService.o bin/Thread.o bin/PatientServiceHandler.o

uge3_client:  PatientClient.cpp
	g++ $(FLAGS) -o bin/$@ $< bin/SocketStream.o bin/SocketAcceptor.o bin/SocketConnector.o bin/InetAddress.o bin/SelectorReactor.o bin/DemuxTable.o bin/MyReactor.o bin/Connector.o bin/Acceptor.o bin/RecvServiceHandler.o bin/Buffer.o bin/PatientService.o bin/Thread.o
